package com;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Shell {
    public static void shell(String cmdstring) throws IOException, InterruptedException {

        Process proc = Runtime.getRuntime().exec(cmdstring);
        // 注意下面的操作
        String ls;
        BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(proc.getInputStream()));
        while ( (ls=bufferedReader.readLine()) != null){
            System.out.println(ls);
        }
        bufferedReader.close();
        proc.waitFor();
    }

}
